public class Demo5 {
    public static void main(String[] args) {
        Point1 point1 = PointFactory.makePointXY(1.0, 2.0);

        System.out.println(point1.a + " " + point1.b);
    }
}

class Point1 {//工厂模式
    public double a;
    public double b;
}

class PointFactory {
    public static Point1 makePointXY(double x, double y) {
        Point1 point1 = new Point1();

        //初始化属性
        point1.a = x;
        point1.b = y;

        return point1;
    }

    public static Point1 makePointRA(double r, double a) {
        Point1 point1 = new Point1();

        //初始化属性
        point1.a = r;
        point1.b = a;

        return point1;
    }
}
